<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test6</title>
</head>
<body>
<input type="button" value="显示时间" onclick="time()">
<script language="JavaScript">
    function time() {
        var dateObj=new Date();
        alert(dateObj);
    }
</script>
</body>
</html>